package com.pro.common.service.user.fallback;

import com.pro.common.api.R;
import com.pro.common.api.model.dto.UserSimpleDTO;
import com.pro.common.api.user.intf.UserFeignClient;
import com.pro.common.api.user.model.db.User;
import com.pro.common.service.user.service.UserService;
import com.pro.common.service.user.service.UserSimpleService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;

//@RestController
@RequestMapping("/")
//@AllArgsConstructor
public class UserFeignFallback<T extends User> implements UserFeignClient<T> {
    @Autowired
    private UserSimpleService<?, T> service;

    @Override
    public List<T> listByIds(List<Long> ids) {
        return service.listByIds(ids);
    }

    @Override
    public Map<Long, T> idMap(Collection<Long> ids) {
        return service.idMap(ids);
    }
    @Override
    public Map<Long, String> idLangMap(Collection<Long> ids) {
        return service.idLangMap(ids);
    }

    @Override
    public T getById(Long id) {
        return service.getById(id);
    }

    @Override
    public boolean updateById(T user) {
        return service.updateById(user);
    }

    @Override
    public List<Long> listIdByPids(List<Long> userIds) {
        return service.listIdByPids(userIds);
    }

    @Override
    public List<T> listByUsernames(List<String> usernames) {
        return service.listByUsernames(usernames);
    }

    @Override
    public List<Long> getIdsByAgentIds(Collection<Long> agentIds) {
        return service.getIdsByAgentIds(agentIds);
    }
}
